package gui;

import interfaces.Command;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import org.apache.log4j.Logger;
import mediator.Mediator;

public class RefreshBtn extends JButton implements Command {

	Mediator med;
	
	public static Logger logger = Logger.getLogger(RefreshBtn.class);
	
	public RefreshBtn (ActionListener act, Mediator md) {
		super("Refresh");
		addActionListener(act);
		med = md;
		med.registerRefreshBtn(this);
		setToolTipText("Press this Button to Refresh the view. (request database update)");
	}
	
	@Override
	public void execute() {
		logger.info("Application view refreshed on demand.");
		med.refresh();
	}

}
